package com.sport.controller;

import com.sport.entity.Sport;
import com.sport.entity.SysPermission;
import com.sport.service.SysPermissionService;
import com.sport.service.SysSportService;
import com.sport.utils.QueryInfo;
import com.sport.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "权限数据")
@RequestMapping("/sport")
public class SysSportController {

    @Autowired
    SysSportService sysSportService;

    @ApiOperation(value = "查询权限信息")
    @PostMapping("/findPage")
    public Result findPage(@RequestBody QueryInfo queryInfo) {
        return sysSportService.findPage(queryInfo);
    }

    @ApiOperation(value = "添加运动信息")
    @PostMapping("/insert")
    public Result insert(@RequestBody Sport sport) {
        return sysSportService.insert(sport);
    }

    @ApiOperation(value = "删除运动信息")
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") Long id) {
        return sysSportService.delete(id);
    }

    @ApiOperation(value = "修改权运动信息")
    @PostMapping("/update")
    public Result update(@RequestBody Sport sport){
        return sysSportService.update(sport);
    }

    @ApiOperation(value = "查看所有的信息")
    @GetMapping("/findAll")
    public Result finAll(){
        return sysSportService.findAll();
    }


}
